﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Text;
using VideoCache.Security;

namespace VideoCache.Security.Implements
{
    public class MD5Provider : ISecurityProvider
    {
        public string Encrypt(string code)
        {
            System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();

            return Convert.ToBase64String(md5.ComputeHash(Encoding.ASCII.GetBytes(code)));
        }

        public string Decrypt(string code)
        {
            throw new NotSupportedException("MD5加密不可解密。");
        }
    }
}